Shader "Hidden/dyer"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
        _Radius ("Radius", float) = 1
        _Inner ("Inner", float) = 0.515
        _Outer ("Outer", float) = 0.602
        _Highlight ("Highlight", float) = 1
        _Opacity ("Opacity", float) = 1
        _Scale ("Scale", float) = 1
        _LineThickness ("LineThickness", float) = 0.1
        _R ("R", float) = 1
        _G ("G", float) = 1
        _B ("B", float) = 1
    }
    SubShader
    {
        // No culling or depth
        //Cull Off ZWrite Off ZTest Always

        Blend SrcAlpha OneMinusSrcAlpha

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            #include "UnityCG.cginc"
            
            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = v.uv;
                return o;
            }

            sampler2D _MainTex;
            float _Radius;
            float _Repeat;
            float _Inner;
            float _Outer;
            float _Highlight;
            float _Opacity;
            float _Scale;
            float _LineThickness;
            float _R;
            float _G;
            float _B;

            fixed4 frag (v2f i) : SV_Target
            {
                float2 uv;
                float4 col;
                
                i.uv -= float2(0.5, 0.5);

                if (length(i.uv) < _Inner || length(i.uv) > _Inner + (_Outer - _Inner) / _Scale) return fixed4(0, 0, 0, 0); 
                else if (length(i.uv) < _Inner + _LineThickness / _Scale || length(i.uv) > _Inner + (_Outer - _LineThickness - _Inner) / _Scale)
                     col = float4(_R * 0.2, _G * 0.2, _B * 0.2, _Opacity);
                else col = float4(_R, _G, _B, _Opacity);
                
                return col;
            }
            ENDCG
        }
    }
}
